/*
 * $Id: ActRequestList.java,v 1.15 2009/12/16 18:31:22 navdeep_mahajan Exp $
 *
 * Copyright (C) 2006 General Electric Company. All Rights Reserved.
 *
 * This software is the confidential and proprietary information of the General
 * Electric Company (GE). You shall not disclose this software and shall use it
 * only in accordance with the terms of the license agreement you entered into
 * with GE.
 *
 * GE MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
 * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
 * NON-INFRINGEMENT. GE SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE
 * AS A RESULT OF USING, MODIFYING, OR DISTRIBUTING THIS SOFTWARE OR ITS
 * DERIVATIVES.
 */

package com.ge.healthcare.autosc.common.database.pojo;

import java.util.List;
import java.util.Vector;

import com.ge.healthcare.autosc.common.ASCUtil;
import com.ge.healthcare.autosc.common.util.TimeFormatStandard;

/**
 * ActRequestList entity.
 * 
 * @author MyEclipse Persistence Tools
 */
public class ActRequestList extends AbstractRequestList implements
		java.io.Serializable {
	/**
	 * Eclipse generated
	 */
	private static final long serialVersionUID = -7410373117817002961L;

	public static final String TABLE_NAME = "com.ge.healthcare.autosc.common.database.pojo.ActRequestList";

	public static final String COL_REQUEST_ID = "requestListId";

	public static final String COL_REQUEST_TYPE_ID = "requestTypeId";

	public static final String COL_PASS_COUNT = "passCount";
	public static final String COL_FAIL_COUNT = "failCount";
	private Vector<ActRequest> requests = new Vector<ActRequest>();

	// Constructors

	/** default constructor */
	public ActRequestList() {
	}

	public boolean equals(ActRequestList rList) {
		if (this.getRequestListId().equals(rList.getRequestListId())
				&& this.getRequestTypeId().equals(rList.getRequestTypeId())
				&& this.getEnterDate().equals(rList.getEnterDate())
				&& this.getScheduledDate().equals(rList.getScheduledDate())) {
			return true;
		} else {
			return false;
		}
	}

	/**
	 * @see java.lang.Object#toString()
	 */
	public String toString() {
		StringBuffer definition = new StringBuffer();
		definition.append("{Request List Id=").append(this.getRequestListId())
				.append("},");
		definition.append("{Batch Id=").append(this.getBatchId()).append("},");
		definition.append("{Request Type Id=").append(this.getRequestTypeId())
				.append("},");
		definition.append("{Enter Date=").append(
				TimeFormatStandard.getDtInEndUserDisplayFormat(this
						.getEnterDate())).append("},");
		definition.append("{Scheduled Date=").append(
				TimeFormatStandard.getDtInEndUserDisplayFormat(this
						.getScheduledDate())).append("},");
		definition.append("{Pass Count=").append(this.getPassCount()).append(
				"},");
		definition.append("{Fail Count=").append(this.getFailCount()).append(
				"},");
		definition.append("{Valid Count=").append(this.getValidCount()).append(
				"},");
		definition.append("{InValid Count=").append(this.getInvalidCount())
				.append("}");
		return definition.toString();
	}

	/**
	 * Set the value of the ENTER_DATE column to current date.
	 * 
	 * @param enterDate
	 */
	public void setEnterDate() {
		setEnterDate(TimeFormatStandard.getNowMillis());
	}

	/**
	 * Set the value of the SCHEDULED_DATE column to current date.
	 */
	public void setScheduledDate() {
		setScheduledDate(TimeFormatStandard.getNowMillis());
	}

	public void addRequest(ActRequest actRequest) {
		requests.add(actRequest);
	}

	public List<ActRequest> getRequests() {
		return requests;
	}

	public ActRequest getRequest(int idx) {
		ActRequest request = null;
		if (!ASCUtil.isNullOrEmptyList(requests)) {
			if (idx >= 0 && idx < requests.size()) {
				request = requests.get(idx);
			}
		}
		return request;
	}

	public Long addInvalidCount(long count) {
		long currentCount = this.getInvalidCount().longValue();
		currentCount += count;
		this.setInvalidCount(new Long(currentCount));
		return this.getInvalidCount();
	}

	public Long addValidCount(long count) {
		long currentCount = this.getValidCount().longValue();
		currentCount += count;
		this.setValidCount(new Long(currentCount));
		return this.getValidCount();
	}
}
